﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OrderManage
{
    public class OrderDetails
    {
        public string ProduceName { get; set; }
        public int Quantity { get; set; }
        public decimal Price { get; set; }

        public override bool Equals(object? obj) =>
            obj is OrderDetails details &&
            ProduceName == details.ProduceName &&
            Quantity == details.Quantity &&
            Price == details.Price;

        public override int GetHashCode() => 
            HashCode.Combine(ProduceName, Quantity, Price);

        public override string ToString() =>
            $"{ProduceName} x {Quantity} 单价:{Price:C} (总共：{Quantity * Price:C})";


    }
}
